import Cookies from "js-cookie";

const TokenKey = "slwl-token";
const userInfo = "userInfo";

export function getToken() {
  return Cookies.get(TokenKey);
}
export function getUserinfo() {
  if (!Cookies.get(userInfo)) {
    return;
  }
  return JSON.parse(Cookies.get(userInfo));
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}
export function setUserinfo(user) {
  return Cookies.set(userInfo, JSON.stringify(user));
}
export function removeToken() {
  return Cookies.remove(TokenKey);
}
export function removeUserinfo() {
  return Cookies.remove(userInfo);
}
